package cn.tedu;

import cn.tedu.util.JDBCUtils;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * Date：2022年03月
 * Author：程Sir
 * Name： JDBC_project
 * Content:
 */
public class JdbcPrepared {
    public static void main(String[] args) {
        try(Connection connection = JDBCUtils.getConnection()) {
            // 创建Statement对象
            Statement statement = connection.createStatement();
            //sql
            String sql1 = "insert into user values (null,'aaa','111')";
            String sql2 = "insert into user values (null,'bbb','111')";
            String sql3 = "insert into user values (null,'ccc','111')";

            // 执行sql对象: 添加进执行计划
            statement.addBatch(sql1);
            statement.addBatch(sql2);
            statement.addBatch(sql3);
            // 执行sql对象: 执行批量计划
            statement.executeBatch();
            System.out.println("执行完成！");

        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }


    }
}
